from app import app,jsonify
import random,string

base_url = 'http://127.0.0.1:5000'
def res_json(code,data,msg):
    if data == None:
        data = 'null'
    if msg == None:
        msg = 'success'

    return jsonify({    
        'code':code,
        'data':data,
        'msg':msg
    })

def res_sucss():
    return jsonify({
        'code':200,
        'msg':'操作成功'
    })
def res_msg(code,msg):
    return jsonify({
        'code':code,    
        'msg':msg
    })

def random_str(digit):
    ran_str = ''.join(random.sample(string.ascii_letters + string.digits, digit))
    return ran_str

def random_num(digit):
    ran_num = ''.join(random.choice("0123456789") for i in range(digit))
    return ran_num




















